import request from "@/utils/request";

// 获取管理用户分页列表 /admin/acl/user/{page}/{limit} get
export const reqGetUserList = (page, limit, searchObj) =>
  request({
    url: `/admin/acl/user/${page}/${limit}`,
    method: "get",
    params: searchObj,
  });

// 根据 id 获取单个用户的信息 get /admin/acl/user/get/{id}

export const reqGetUserInfo = (id) =>
  request({
    url: `/admin/acl/user/get/${id}`,
    method: "get",
  });

// 新增管理用户 /admin/acl/user/save post
export const reqAddUser = (user) =>
  request({
    url: "/admin/acl/user/save",
    data: user,
    method: "post",
  });
// 修改管理用户 /admin/acl/user/update put
export const reqUpdateUser = (user) =>
  request({
    url: `/admin/acl/user/update`,
    data: user,
    method: "put",
  });

// 根据id 删除管理用户 /admin/acl/user/remove/{id}  delete
export const reqDeleteUser = (id) =>
  request({
    url: `/admin/acl/user/remove/${id}`,
    method: "delete",
  });

// 根据用户id获取角色数据 /admin/acl/user/toAssign/{userId}  get
export const reqGetRoles = (userId) =>
  request({
    url: `/admin/acl/user/toAssign/${userId}`,
    method: "get",
  });

// 根据用户分配角色 /admin/acl/user/doAssign post
export const reqDoAssign = (userId, roleId) =>
  request({
    url: `/admin/acl/user/doAssign`,
    method: "post",
    params: {
      userId,
      roleId,
    },
  });

// 根据id列表删除用户， 批量删除 /admin/acl/user/batchRemove delete
export const reqDeleteAllUser = (isList) =>
  request({
    url: "/admin/acl/user/batchRemove",
    data: isList,
    method: "delete",
  });
